package com.glsc.ngateway.filetransfer.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.sql.DataSource;


@Configuration
public class DataSourceDefConfig {
    private static Logger logger = LoggerFactory.getLogger(DataSourceDefConfig.class);

    public static final String DS_MYSQL = "datasourceMysql";
//    public static final String DS_MYSQL_GATEWAY = "datasourceMysqlGateway";

    @Primary
    @Bean(name = DS_MYSQL)
    @ConfigurationProperties("spring.datasource.gatewaydb")
    public DataSource datasourceMysql() {
        DataSource dataSource = DataSourceBuilder.create().build();
        return dataSource;
    }

//    @Bean(name = DS_MYSQL_GATEWAY)
//    @ConfigurationProperties("spring.datasource.gatewaydb")
//    public DataSource datasourceMysqlGateway() {
//        return DataSourceBuilder.create().build();
//    }

}